﻿using System.Text;
using Microsoft.SqlServer.Dts.Runtime;
using Microsoft.SqlServer.Dts.Tasks.SendMailTask;

namespace NazTek.Documenter.Ssis.Control.Tasks
{
    internal class SsisMail : SsisTaskBase
    {
        public override string Documentation
        {
            get
            {
                var doc = new StringBuilder(string.Format(
                    "<li>{0} [{1}]<br>Connection: {2}<br><pre><code>From:\t {3}<br>To:\t {4}<br>CC:\t {5}<br>Subject: {6}</code></pre></li>",
                    Name, Description, Component.SmtpConnection, Component.FromLine, Component.ToLine, Component.CCLine,
                    Component.Subject));
                return doc.ToString();
            }
        }

        internal SsisMail(TaskHost component)
        {
            Name = component.Name;
            Description = component.Description;
            Component = (SendMailTask)component.InnerObject;
        }

        private SendMailTask Component { get; set; }
    }
}